package java_persistence;

import org.apache.ibatis.annotations.Param;

import domain.Orders;


/**
 * @author joseph simoneau <simoneau@gatech.edu>
 *
 */
public interface OrdersMapper {

	// CREATES
	
	/**Saves an Orders object in the database.
	 * @param d the associated appointment date
	 * @param pu the associate patient's username
	 * @param p any prescriptions given
	 * @param lw description of any lab work
	 * @param fui followup instructions
	 * @param oi other instructions
	 */
	public void create_orders(@Param("date") String d,
							  @Param("patient_username") String pu,
							  @Param("prescription") String p,
							  @Param("lab_work") String lw,
							  @Param("folloup_instructions") String fui,
							  @Param("other_instructions") String oi);
	
	// RETRIEVES
	
	/**Retrieves an Orders object from the db for a treatment record associated with an appointment on date for the patient with username pu 
	 * @param d the date of the appointment as a string with the format "YYYY-MM-DD HH:MM:SS"
	 * @param pu the username of the patient
	 * @return the Orders object.
	 */
	public Orders retrieve(@Param("date") String d, @Param("patient_username") String pu);
	/**retrieves lab work associated with the orders stored with a treatment record associated with an appointment on date with patient with username pu
	 * @param d the date of the appointment.
	 * @param pu the username of the patient
	 * @return a string describing the lab work performed.
	 */
	public String get_lab_work(@Param("date") String d, @Param("patient_username") String pu);
	
	// UPDATES
	
	/**Updates the information associated with an Orders object in the database.
	 * 
	 * Note that you cannot change the date (d) or the patient username (pu) from their original values,
	 * doing so will cause an integrity constraint violation.
	 * 
	 * @param d the date of the assoicated appointment.
	 * @param pu the usernaem of the associated patient
	 * @param p any presriptions given at the appointment
	 * @param lw any lab work perfomred at the appointment
	 * @param fui followup instructions given at the appointment
	 * @param oi other instructions given at the appointment.
	 */
	public void update_orders(@Param("date") String d,
			  				  @Param("patient_username") String pu,
			  				  @Param("prescription") String p,
			  				  @Param("lab_work") String lw,
			  				  @Param("folloup_instructions") String fui,
			  				  @Param("other_instructions") String oi);
	
	// DELETES
	
	/**Deletes a set of orders from the database.
	 * 
	 * Please note that it is irresponsible and in some cases illegal to delete medical records.
	 * This method exists primarily for testing purposes.
	 * 
	 * @param d the date of the associated appointment
	 * @param pu the username of the associated patient.
	 */
	public void delete_orders(@Param("date") String d, @Param("patient_username") String pu);
	
}
